<!-- 渠道 -->
<div class="wrapper">
	<!-- second-nav -->
	<!-- <div ng-include="'main/recruit/nav.html'"></div> -->
	<!-- wrapper-content -->
	<section class="wrapper-content">
		<div class="container-fluid">
			<h2 class="content-title"><span class="margin-right-10">渠道管理</span><small>渠道列表</small></h2>
		</div>
		<!-- btn-row -->
		<div class="btn-row clearfix">
			<div class="col-md-6">
				<button class="btn btn-primary" ng-click="openAdd()">添加</button>
			</div>
		</div>
		<!-- ng-table-row -->
		<div class="row">
			<div class="container-fluid">
				<div class="col-md-12">
					<table class="table table-bordered" ng-table="channelList">
						<tr ng-repeat="item in $data">
							<td title="'分类'" sortable="'channelTypeId'">{{item.channelTypeId.name}}</td>
							<td title="'名称'" sortable="'name'">{{item.name}}</td>
							<td title="'拥有人'" sortable="'owner'">{{item.owner.name}}</td>
							<td title="'联系人'" sortable="'contact'">{{item.contact}}</td>
							<td title="'联系电话'" sortable="'tel'">{{item.tel}}</td>
							<td title="'联系手机'" sortable="'mobile'">{{item.mobile}}</td>
							<td title="'联系邮件'" sortable="'email'">{{item.email}}</td>
							<td title="'操作'" class="text-center">
								<div class="btn-group">
	                                <button ng-click="openEdit(item);" class="btn btn-sm btn-success" title="编辑"><i class="fa fa-pencil"></i></button>
	                                <button ng-click="openDel(item);" class="btn btn-sm btn-warning" title="删除"><i class="fa fa-times"></i></button>
	                            </div>
							</td>
						</tr>
					</table>
					<div class="row">
						<div class="col-md-6">
							<div class="pull-left btn btn-default">总数：<span class="badge">{{ totalRow }}</span></div>	
						</div>
						<div class="col-md-6">
							<!-- 分页 -->
							<nav>
								<ul class="pagination ng-table-pagination fr">
									<li>
										<a ng-click="previous()"><span>上一页</span></a>
									</li>
									<li ng-repeat="page in pageList" ng-class="{active: isActivePage(page)}" >
										<a ng-click="getChannelList(page)">{{ page }}</a>
									</li>
									<li>
										<a ng-click="next()"><span>下一页</span></a>
									</li>
								</ul>
							</nav>
						</div>
					</div>
				</div>
			</div>
		</div>

		<!-- 删除 delChanModel -->
		<div class="modal" id="delChanModel" tabindex="-1" role="dialog">
			<div class="modal-dialog" role="document">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        				<h3 class="modal-title">删除</h3>
					</div>
					<div class="modal-body">
						<p class="text-danger text-center">删除将造成相关数据丢失，请确认是否继续删除。</p>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-primary" ng-click="delChan()">确认</button>
						<button type="button" class="btn btn-warning" data-dismiss="modal">取消</button>
					</div>
				</div>
			</div>
		</div>
		
		<!-- 新增 newChanModel -->
		<div class="modal" id="newChanModel" tabindex="-1" role="dialog" aria-labelledby="newChanModel" aria-hidden="true">
			<div class="modal-dialog modal-lg" role="document">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        				<h3 class="modal-title">添加</h3>
					</div>
					<div class="modal-body">
						<div class="form-horizontal">
							<!-- 名称 -->
							<div class="form-group">
								<div class="control-label col-md-4">
								    <span ng-show="true" class="text-danger">*</span>
								    <label for="name">名称</label>
								</div>
								<div class="col-md-6">
									<div><input id="name" name="name" class="form-control" placeholder="名称" type="text" ng-model="newChanItem.name" ng-change="watchName('newChanItem')"></div>
								</div>
								<div class="col-md-2 text-danger" ng-bind="newChanItem.warn.name"></div>
							</div>
							<!-- 分类 -->
							<div class="form-group">
								<div class="control-label col-md-4">
								    <span ng-show="true" class="text-danger">*</span>
								    <label for="channelTypeId">分类</label>
								</div>
								<div class="col-md-6">
									<select class="form-control" ng-model="newChanItem.select.channelTypeId" ng-options="item.name for item in newChanItem.channelTypeList" ng-change="watchChannelTypeId('newChanItem')">
										<option value="">-- 请选择 --</option>
									</select>
								</div>
								<div class="col-md-2 text-danger" ng-bind="newChanItem.warn.channelTypeId"></div>
							</div>
							<!-- 拥有人 -->
							<div class="form-group">
								<div class="control-label col-md-4">
								    <span ng-show="true" class="text-danger">*</span>
								    <label for="owner">拥有人</label>
								</div>
								<div class="col-md-6">
									<select class="form-control" ng-model="newChanItem.select.owner" ng-options="item.name for item in newChanItem.userList" ng-change="watchOwner('newChanItem')">
										<option value="">-- 请选择 --</option>
									</select>
								</div>
								<div class="col-md-2 text-danger" ng-bind="newChanItem.warn.owner"></div>
							</div>
							<!-- 联系人 -->
							<div class="form-group">
								<div class="control-label col-md-4">
								    <span ng-show="false" class="text-danger">*</span>
								    <label for="contact">联系人</label>
								</div>
								<div class="col-md-6">
									<div><input id="contact" name="contact" class="form-control" placeholder="联系人" type="text" ng-model="newChanItem.contact"></div>
								</div>
								<div class="col-md-2 text-danger" ng-bind="newChanItem.warn.contact"></div>
							</div>
							<!-- 联系电话 -->
							<div class="form-group">
								<div class="control-label col-md-4">
								    <span ng-show="false" class="text-danger">*</span>
								    <label for="tel">联系电话</label>
								</div>
								<div class="col-md-6">
									<div class="input-group">
										<span class="input-group-addon"><i class="fa fa-mobile"></i></span>
										<input id="tel" name="tel" class="form-control" type="text" ng-model="newChanItem.tel">
									</div>
								</div>
								<div class="col-md-2 text-danger" ng-bind="newChanItem.warn.tel"></div>
							</div>
							<!-- 联系手机 -->
							<div class="form-group">
								<div class="control-label col-md-4">
								    <span ng-show="false" class="text-danger">*</span>
								    <label for="mobile">联系手机</label>
								</div>
								<div class="col-md-6">
									<div class="input-group">
										<span class="input-group-addon"><i class="fa fa-mobile"></i></span>
										<input id="mobile" name="mobile" class="form-control" type="text" ng-model="newChanItem.mobile">
									</div>
								</div>
								<div class="col-md-2 text-danger" ng-bind="newChanItem.warn.mobile"></div>
							</div>
							<!-- 联系邮件 -->
							<div class="form-group">
								<div class="control-label col-md-4">
								    <span ng-show="false" class="text-danger">*</span>
								    <label for="email">联系邮件</label>
								</div>
								<div class="col-md-6">
									<div class="input-group">
										<span class="input-group-addon"><i class="fa fa-envelope"></i></span>
										<input id="inputemail" name="inputemail" class="form-control" type="text" enable-validate="true" ng-model="newChanItem.email">
									</div>
								</div>
								<div class="col-md-2 text-danger" ng-bind="newChanItem.warn.email"></div>
							</div>
							<!-- 描述 -->
							<div class="form-group">
								<div class="control-label col-md-4">
								    <span ng-show="false" class="text-danger">*</span>
								    <label for="description">描述</label>
								</div>
								<div class="col-md-6">
									<textarea class="form-control" name="description" id="description" ng-model="newChanItem.description" placeholder="角色描述"></textarea>
								</div>
							</div>
						</div>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-primary" ng-click="addChan()">提交</button>
						<button type="button" class="btn btn-warning" data-dismiss="modal">取消</button>
					</div>
				</div>
			</div>
		</div>

		<!-- 修改 editChanModel -->
		<div class="modal" id="editChanModel" tabindex="-1" role="dialog" aria-labelledby="editChanModel" aria-hidden="true">
			<div class="modal-dialog modal-lg" role="document">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        				<h3 class="modal-title">编辑</h3>
					</div>
					<div class="modal-body">
						<div class="form-horizontal">
							<!-- 名称 -->
							<div class="form-group">
								<div class="control-label col-md-4">
								    <span ng-show="true" class="text-danger">*</span>
								    <label for="name">名称</label>
								</div>
								<div class="col-md-6">
									<div><input id="name" name="name" class="form-control" placeholder="名称" type="text" ng-model="modChanItem.channel.name" ng-change="watchName('modChanItem')"></div>
								</div>
								<div class="col-md-2 text-danger" ng-bind="modChanItem.warn.name"></div>
							</div>
							<!-- 分类 -->
							<div class="form-group">
								<div class="control-label col-md-4">
								    <span ng-show="true" class="text-danger">*</span>
								    <label for="channelTypeId">分类</label>
								</div>
								<div class="col-md-6">
									<select class="form-control" ng-model="modChanItem.select.channelTypeId" ng-options="item.name for item in modChanItem.channelTypeList" ng-change="watchChannelTypeId('modChanItem')">
										<option value="">-- 请选择 --</option>
									</select>
								</div>
								<div class="col-md-2 text-danger" ng-bind="modChanItem.warn.channelTypeId"></div>
							</div>
							<!-- 拥有人 -->
							<div class="form-group">
								<div class="control-label col-md-4">
								    <span ng-show="true" class="text-danger">*</span>
								    <label for="owner">拥有人</label>
								</div>
								<div class="col-md-6">
									<select class="form-control" ng-model="modChanItem.select.owner" ng-options="item.name for item in modChanItem.userList" ng-change="watchOwner('modChanItem')">
										<option value="">-- 请选择 --</option>
									</select>
								</div>
								<div class="col-md-2 text-danger" ng-bind="modChanItem.warn.owner"></div>
							</div>
							<!-- 联系人 -->
							<div class="form-group">
								<div class="control-label col-md-4">
								    <span ng-show="false" class="text-danger">*</span>
								    <label for="contact">联系人</label>
								</div>
								<div class="col-md-6">
									<div><input id="contact" name="contact" class="form-control" placeholder="联系人" type="text" ng-model="modChanItem.channel.contact"></div>
								</div>
								<div class="col-md-2 text-danger" ng-bind="modChanItem.warn.contact"></div>
							</div>
							<!-- 联系电话 -->
							<div class="form-group">
								<div class="control-label col-md-4">
								    <span ng-show="false" class="text-danger">*</span>
								    <label for="tel">联系电话</label>
								</div>
								<div class="col-md-6">
									<div class="input-group">
										<span class="input-group-addon"><i class="fa fa-mobile"></i></span>
										<input id="tel" name="tel" class="form-control" type="text" ng-model="modChanItem.channel.tel">
									</div>
								</div>
								<div class="col-md-2 text-danger" ng-bind="modChanItem.warn.tel"></div>
							</div>
							<!-- 联系手机 -->
							<div class="form-group">
								<div class="control-label col-md-4">
								    <span ng-show="false" class="text-danger">*</span>
								    <label for="mobile">联系手机</label>
								</div>
								<div class="col-md-6">
									<div class="input-group">
										<span class="input-group-addon"><i class="fa fa-mobile"></i></span>
										<input id="mobile" name="mobile" class="form-control" type="text" ng-model="modChanItem.channel.mobile">
									</div>
								</div>
								<div class="col-md-2 text-danger" ng-bind="modChanItem.warn.mobile"></div>
							</div>
							<!-- 联系邮件 -->
							<div class="form-group">
								<div class="control-label col-md-4">
								    <span ng-show="false" class="text-danger">*</span>
								    <label for="email">联系邮件</label>
								</div>
								<div class="col-md-6">
									<div class="input-group">
										<span class="input-group-addon"><i class="fa fa-envelope"></i></span>
										<input id="inputemail" name="inputemail" class="form-control" type="text" enable-validate="true" ng-model="modChanItem.channel.email">
									</div>
								</div>
								<div class="col-md-2 text-danger" ng-bind="modChanItem.warn.email"></div>
							</div>
							<!-- 描述 -->
							<div class="form-group">
								<div class="control-label col-md-4">
								    <span ng-show="false" class="text-danger">*</span>
								    <label for="description">描述</label>
								</div>
								<div class="col-md-6">
									<textarea class="form-control" name="description" id="description" ng-model="modChanItem.channel.description" placeholder="角色描述"></textarea>
								</div>
							</div>
						</div>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-primary" ng-click="editChan()">提交</button>
						<button type="button" class="btn btn-warning" data-dismiss="modal">取消</button>
					</div>
				</div>
			</div>
		</div>

		<!-- 提示 infoModel -->
		<info-modal msg="msg" visible="visible"></info-modal>
	</section>
</div>